def multiply(num1, num2):
    num1_len, num2_len = len(num1), len(num2)
    res = ['0' for e in range((num1_len + num2_len))]
    for i in range(num2_len-1, -1, -1):
        for j in range(num1_len-1, -1, -1):
            mult_value = int(num1[j]) * int(num2[i]) + int(res[i + j + 1])
            res[i + j + 1] = str(mult_value%10)
            res[i + j] = str(int(res[i+j]) + mult_value // 10)
    first_not_zero = -1
    for i in res:
        if i!='0':
            first_not_zero = res.index(i)
            break
    if first_not_zero == -1:
        return '0'
    else:
        return "".join(res[first_not_zero:])
def multiply1(num1,num2):
    len_num1,len_num2 = len(num1),len(num2)
    res = [0 for e in range(0,len_num1+len_num2)]
    for i in range(len_num1,-1,-1):
        for j in range(len_num2,-1,-1):
            mult_value = (num1[i])*int(num2[j])
            res[i+j-1] = mult_value/10
            res = mult_value%10+res[i+j-1]
def main():
    s1 = "123"
    s2 = "456"
    print(multiply(s1,s2))
if __name__ == "__main__":
    main()
